<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>

<div>
    <a id="upload_id" href="#">上传简历</a>
</div>

<table id="table-8">
    <tbody><tr>
        <th>职位名称</th>
        <th>公司名称</th>
        <th>操作</th>
    </tr>

    <c:forEach items="${list}" var="item2">
        <tr>
            <td>${item2.jobName}</td>
            <td>${item2.companyName}</td>
            <td data="${item2.companyId}">
                <a class="click_id" href="#">查看</a> | <a class="coll_id" href="#">收藏</a> | <a class="send_id" href="#">投递</a>
            </td>
        </tr>
    </c:forEach>

    </tbody>
</table>

<script type="application/javascript">
    //收藏
    $(".coll_id").click(function () {
        var sendData = {}
        sendData["user_name"] = '${user.username}';
        sendData["act_time"] = Date.now();
        sendData["action"] = "job_collect";
        sendData["job_code"] = $(this).parent().attr("data");

        $.ajax({
            url: "http://localhost:8888/action_data",
            type:"POST",
            contentType:"application/json",
            dataType:"json",
            data:JSON.stringify(sendData),
            success: function (data) {

            }
        });
    });

    $(".click_id").click(function () {
        var sendData = {}
        sendData["user_name"] = '${user.username}';
        sendData["act_time"] = Date.now();
        sendData["action"] = "click";
        sendData["job_code"] = $(this).parent().attr("data");
        $.ajax({
            url: "http://localhost:8888/action_data",
            type:"POST",
            contentType:"application/json",
            dataType:"json",
            data:JSON.stringify(sendData),
            success: function (data) {

            }
        });
    });

    $(".send_id").click(function () {
        var sendData = {}
        sendData["user_name"] = '${user.username}';
        sendData["act_time"] = Date.now();
        sendData["action"] = "cv_send";
        sendData["job_code"] = $(this).parent().attr("data");
        $.ajax({
            url: "http://localhost:8888/action_data",
            type:"POST",
            contentType:"application/json",
            dataType:"json",
            data:JSON.stringify(sendData),
            success: function (data) {

            }
        });
    });

    //上传
    $("#upload_id").click(function () {
        var sendData = {}
        sendData["user_name"] = '${user.username}';
        sendData["act_time"] = Date.now();
        sendData["action"] = "cv_upload";
        $.ajax({
            url: "http://localhost:8888/action_data",
            type:"POST",
            contentType:"application/json",
            dataType:"json",
            data:JSON.stringify(sendData),
            success: function (data) {

            }
        });
    });

</script>